package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.core.util.DateUtil;
import cn.stylefeng.guns.sys.modular.system.entity.BtyBank;
import cn.stylefeng.guns.sys.modular.system.entity.BtyBrand;
import cn.stylefeng.guns.sys.modular.system.mapper.BtyBankMapper;
import cn.stylefeng.guns.sys.modular.system.model.params.BtyBankParam;
import cn.stylefeng.guns.sys.modular.system.model.result.BtyBankResult;
import cn.stylefeng.guns.sys.modular.system.service.BtyBankService;
import cn.stylefeng.guns.sys.modular.system.service.BtyBrandService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import cn.stylefeng.roses.core.util.ToolUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.util.List;


/**
 * 控制器
 *
 * @author liuy
 * @Date 2021-09-28 16:41:21
 */
@Controller
@RequestMapping("/btyBank")
public class BtyBankController extends BaseController {

    private String PREFIX = "/modular/system/btyBank";

    @Autowired
    private BtyBankService btyBankService;
    @Resource
    private BtyBankMapper btyBankMapper;
    @Resource
    private BtyBrandService btyBrandService;

    /**
     * 跳转到主页面
     *
     * @author liuy
     * @Date 2021-09-28
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/btyBank.html";
    }

    /**
     * 新增页面
     *
     * @author liuy
     * @Date 2021-09-28
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/btyBank_add.html";
    }

    /**
     * 编辑页面
     *
     * @author liuy
     * @Date 2021-09-28
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/btyBank_edit.html";
    }

    /**
     * 新增接口
     *
     * @author liuy
     * @Date 2021-09-28
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(BtyBankParam btyBankParam) {
        this.btyBankService.add(btyBankParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author liuy
     * @Date 2021-09-28
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(BtyBankParam btyBankParam) {
        this.btyBankService.update(btyBankParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author liuy
     * @Date 2021-09-28
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(BtyBankParam btyBankParam) {
        this.btyBankService.delete(btyBankParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author liuy
     * @Date 2021-09-28
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(BtyBankParam btyBankParam) {
        BtyBank detail = this.btyBankService.getById(btyBankParam.getId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author liuy
     * @Date 2021-09-28
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(BtyBankParam btyBankParam) {
        return this.btyBankService.findPageBySpec(btyBankParam);
    }

    /**
     * 查询店名
     */
    @RequestMapping(value = "/getDm")
    @ResponseBody
    public List<BtyBankResult> getDm(BtyBankParam btyBankParam) {
        List<BtyBankResult> list=btyBankService.dmList(btyBankParam);

        return list;
    }
    /**
     * 银行账收入凭证
     */
    @RequestMapping(value = "/confirmOk")
    @ResponseBody
    public ResponseData confirmOk(BtyBankParam param) throws ParseException {
        String beginTime = "";
        String endTime = "";
        String firstDay="";
        String lastDay="";
        String lastDays="";
        if (ToolUtil.isNotEmpty(param.getTimeLimit())) {
            String[] split = param.getTimeLimit().split(" - ");
            beginTime = split[0].replace("-","");
            endTime = split[1].replace("-","");
            //获取beginTime所在月的第一天和最后一天
            firstDay= DateUtil.getMonthFirstDay(beginTime);
            //lastDay=DateUtil.getMonthLastDay(beginTime);
            lastDay=DateUtil.getMonthLastDays(endTime);
            lastDays=DateUtil.getLastDayByMonths(split[1]);
            param.setBeginTime(beginTime);
            param.setEndTime(endTime);
            param.setFirstDay(firstDay);
            param.setLastDay(lastDay);
        }
        String yaoma=param.getYaoma();
        //通过妖码获取银行卡号
        BtyBrand brand=btyBrandService.getOne(new QueryWrapper<BtyBrand>().eq("yaoma",yaoma));
        String yhk="";
        if(ToolUtil.isNotEmpty(brand)){
            yhk=brand.getKh();
        }
        BtyBankResult  results=btyBankMapper.getSxfByDm(param);
        List<BtyBankResult>list=btyBankMapper.bankListByDm(param);

        BigDecimal zfbsxf=BigDecimal.ZERO;
        BigDecimal wxsxf=BigDecimal.ZERO;
        BigDecimal mdsxf=BigDecimal.ZERO;
        BigDecimal mtsxf=BigDecimal.ZERO;
        BigDecimal sxfsxf=BigDecimal.ZERO;
        //获取单店的支付宝手续费，微信手续费，买单手续费，美团手续费
        if(ToolUtil.isNotEmpty(results)){
            zfbsxf=results.getZfbsxf().setScale(2, BigDecimal.ROUND_HALF_UP);
            wxsxf=results.getWxsxf();
            mdsxf=results.getMdsxf();
            mtsxf=results.getMtsxf();
            sxfsxf=results.getSxfsxf();
        }
        //美团团购
        BigDecimal mttg=BigDecimal.ZERO;
        //美团买单
        BigDecimal mtmd=BigDecimal.ZERO;
        //微信
        BigDecimal wx=BigDecimal.ZERO;
        //会员卡
        BigDecimal hyk=BigDecimal.ZERO;
        //现金
        BigDecimal xj=BigDecimal.ZERO;
        //支付宝
        BigDecimal zfb=BigDecimal.ZERO;
        //饿了么
        BigDecimal elm=BigDecimal.ZERO;
        //美团外卖
        BigDecimal mtwm=BigDecimal.ZERO;
        //建行收款
        BigDecimal jhsk=BigDecimal.ZERO;
        //废品
        BigDecimal fp=BigDecimal.ZERO;
        //联联
        BigDecimal ll=BigDecimal.ZERO;
        //抖音
        BigDecimal dy=BigDecimal.ZERO;
        //安徽抖音
        BigDecimal ahdy=BigDecimal.ZERO;

        //商场收款
        BigDecimal scsk=BigDecimal.ZERO;

        //管培生
        BigDecimal gps=BigDecimal.ZERO;
        //当地平台
        BigDecimal ddpt=BigDecimal.ZERO;
        //随行付
        BigDecimal sxf=BigDecimal.ZERO;
        for (BtyBankResult yybbResult : list) {
            String zy=yybbResult.getZy()==null?"":yybbResult.getZy();
            if(zy.contains("美团团购")){
                mttg=mttg.add(yybbResult.getSr());
            } else if(zy.contains("美团买单")|zy.contains("超值优惠券包")){
                mtmd=mtmd.add(yybbResult.getSr());
            }else if(zy.contains("微信分")){
                wx=wx.add(yybbResult.getSr());
            }else if(zy.contains("会员分")){
                hyk=hyk.add(yybbResult.getSr());
            }else if(zy.contains("xj")|zy.contains("现金")){
                xj=xj.add(yybbResult.getSr()==null?BigDecimal.ZERO:yybbResult.getSr());
            }else if(zy.contains("宝宝分")){
                zfb=zfb.add(yybbResult.getSr());
            }else if(zy.contains("美团外卖")){
                mtwm=mtwm.add(yybbResult.getSr());
            }else if(zy.contains("饿了么")|zy.contains("elm")){
                elm=elm.add(yybbResult.getSr());
            }else if(zy.contains("建行分")){
                jhsk=jhsk.add(yybbResult.getSr());
            }else if(zy.contains("废品")|zy.contains("垃圾费")){
                fp=fp.add(yybbResult.getSr());
            }else if(zy.contains("联联")){
                ll=ll.add(yybbResult.getSr());
            }else if(zy.contains("抖音")){
                dy=dy.add(yybbResult.getSr());
            }else if(zy.contains("管培")){
                gps=gps.add(yybbResult.getSr());
            }else if(zy.contains("当地平台")){
                ddpt=ddpt.add(yybbResult.getSr());
            }else if(zy.contains("半天妖烤鱼(")){
                ahdy=ahdy.add(yybbResult.getSr());
            } else if(zy.contains("商场")){
                scsk=scsk.add(yybbResult.getSr());
            }else if(zy.contains("随行付分")){
                sxf=sxf.add(yybbResult.getSr());
            }
        }

        int mttgFlag=mttg.compareTo(BigDecimal.ZERO);
        int mtmdFlag=mtmd.compareTo(BigDecimal.ZERO);
        int wxFlag=wx.compareTo(BigDecimal.ZERO);
        int hykFlag=hyk.compareTo(BigDecimal.ZERO);
        int xjFlag=xj.compareTo(BigDecimal.ZERO);
        int zfbFlag=zfb.compareTo(BigDecimal.ZERO);
        int mtwmFlag=mtwm.compareTo(BigDecimal.ZERO);
        int elmFlag=elm.compareTo(BigDecimal.ZERO);

        int jhskFlag=jhsk.compareTo(BigDecimal.ZERO);
        int fpFlag=fp.compareTo(BigDecimal.ZERO);
        int llFlag=ll.compareTo(BigDecimal.ZERO);
        int dyFlag=dy.compareTo(BigDecimal.ZERO);
        int gpsFlag=gps.compareTo(BigDecimal.ZERO);
        int ddptFlag=ddpt.compareTo(BigDecimal.ZERO);

        int mdsxfFlag=mdsxf.compareTo(BigDecimal.ZERO);

        int zfbsxfFlag=zfbsxf.compareTo(BigDecimal.ZERO);
        int mtsxfFlag=mtsxf.compareTo(BigDecimal.ZERO);
        int wxsxfFlag=wxsxf.compareTo(BigDecimal.ZERO);

        int ahdyFlag=ahdy.compareTo(BigDecimal.ZERO);

        int scskFlag=scsk.compareTo(BigDecimal.ZERO);


        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("trantype", "code"); // 档案翻译方式，枚举值为：编码请录入 code， 名称请录入 name， 主键请录入 pk
        headers.add("system", "001"); // 系统编码
        headers.add("usercode", "15253172037"); // 用户
        headers.add("password", "514576f58a89767b46c1b44767a08f77");
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        BigDecimal mtDf=mtsxf.add(mttg);
        BigDecimal mdDf=mdsxf.add(mtmd);
        BigDecimal wxDf=wxsxf.add(wx);
        BigDecimal zfbDf=zfbsxf.add(zfb);
        BigDecimal sxfDf=sxfsxf.add(sxf);
        StringBuilder sb=new StringBuilder();
        sb.append("{\n" +
                "    \"voucher\":[\n" +
                "        {\n" +
                "            \"details\":[");

        //美团团购金额大于0的话，生成美团团购的凭证
        if(mttgFlag==1){
            if(mtsxfFlag==1) {
                sb.append("                {\n" +
                        "                    \"ass\":[\n" +
                        "                        {\n" +
                        "                            \"checktypecode\":\"2\",\n" +
                        "                            \"checkvaluecode\":'" + param.getYaoma() + "'\n" +
                        "                        }\n" +
                        "                    ],\n" +
                        "                    \"creditamount\":\"\",\n" +
                        "                    \"debitamount\":\"" + mtsxf + "\",\n" +
                        "                    \"explanation\":\"美团服务费\",\n" +
                        "                    \"localcreditamount\":\"\",\n" +
                        "                    \"localdebitamount\":\"\",\n" +
                        "                    \"pk_accsubj\":\"660120\",\n" +
                        "                    \"pk_currtype\":\"CNY\"\n" +
                        "                },");
            }
                    sb.append("{\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+param.getYaoma()+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+mttg+"\",\n" +
                    "                    \"explanation\":\"收美团\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },"+
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+param.getYaoma()+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0031\"\n" + //美团团购编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+mtDf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收美团\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112205\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n" );
        }
        if(elmFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+elm+"\",\n" +
                    "                    \"explanation\":\"收饿了么\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0019\"\n" + //饿了么外卖编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+elm+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收饿了么\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112212\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //美团买单金额大于0的话，生成美团买单的凭证
        if(mtmdFlag==1){
            if(mdsxfFlag==1){
                sb.append("                {\n" +
                        "                    \"ass\":[\n" +
                        "                        {\n" +
                        "                            \"checktypecode\":\"2\",\n" +
                        "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                        "                        }\n" +
                        "                    ],\n" +
                        "                    \"creditamount\":\"\",\n" +
                        "                    \"debitamount\":\""+mdsxf+"\",\n" +
                        "                    \"explanation\":\"买单手续费\",\n" +
                        "                    \"localcreditamount\":\"\",\n" +
                        "                    \"localdebitamount\":\"\",\n" +
                        "                    \"pk_accsubj\":\"660306\",\n" +
                        "                    \"pk_currtype\":\"CNY\"\n" +
                        "                }," );
            }
            sb.append( "{\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+mtmd+"\",\n" +
                    "                    \"explanation\":\"收买单\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },"+
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0015\"\n" + //点评买单编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+mdDf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收买单\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112208\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        if(wxFlag==1){
            if(wxsxfFlag==1) {
                sb.append("                {\n" +
                        "                    \"ass\":[\n" +
                        "                        {\n" +
                        "                            \"checktypecode\":\"2\",\n" +
                        "                            \"checkvaluecode\":'" + yaoma + "'\n" +
                        "                        }\n" +
                        "                    ],\n" +
                        "                    \"creditamount\":\"\",\n" +
                        "                    \"debitamount\":\"" + wxsxf + "\",\n" +
                        "                    \"explanation\":\"微信手续费\",\n" +
                        "                    \"localcreditamount\":\"\",\n" +
                        "                    \"localdebitamount\":\"\",\n" +
                        "                    \"pk_accsubj\":\"660306\",\n" +
                        "                    \"pk_currtype\":\"CNY\"\n" +
                        "                },");
            }
            sb.append("{\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+wx+"\",\n" +
                    "                    \"explanation\":\"收微信\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },"+
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0172\"\n" + //微信收款编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+wxDf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收微信\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112206\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        if(hykFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+hyk+"\",\n" +
                    "                    \"explanation\":\"收会员卡\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0022\"\n" + //会员卡储值编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+hyk+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收会员卡\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112210\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        if(xjFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+xj+"\",\n" +
                    "                    \"explanation\":\"收现金\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0038\"\n" + //人民币编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+xj+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收现金\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112203\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        if(zfbFlag==1){
            if(zfbsxfFlag==1) {
                sb.append("                {\n" +
                        "                    \"ass\":[\n" +
                        "                        {\n" +
                        "                            \"checktypecode\":\"2\",\n" +
                        "                            \"checkvaluecode\":'" + yaoma + "'\n" +
                        "                        }\n" +
                        "                    ],\n" +

                        "                    \"creditamount\":\"\",\n" +
                        "                    \"debitamount\":\"" + zfbsxf + "\",\n" +
                        "                    \"explanation\":\"支付宝手续费\",\n" +
                        "                    \"localcreditamount\":\"\",\n" +
                        "                    \"localdebitamount\":\"\",\n" +
                        "                    \"pk_accsubj\":\"660306\",\n" +
                        "                    \"pk_currtype\":\"CNY\"\n" +
                        "                },");
            }
                   sb.append("{\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+zfb+"\",\n" +
                    "                    \"explanation\":\"收支付宝\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },"+
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0189\"\n" + //支付宝收款编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+zfbDf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收支付宝\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112207\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //随行付凭证
        if(sxf.compareTo(BigDecimal.ZERO)==1){
            if(sxfsxf.compareTo(BigDecimal.ZERO)==1) {
                sb.append("                {\n" +
                        "                    \"ass\":[\n" +
                        "                        {\n" +
                        "                            \"checktypecode\":\"2\",\n" +
                        "                            \"checkvaluecode\":'" + yaoma + "'\n" +
                        "                        }\n" +
                        "                    ],\n" +

                        "                    \"creditamount\":\"\",\n" +
                        "                    \"debitamount\":\"" + sxfsxf + "\",\n" +
                        "                    \"explanation\":\"随行付手续费\",\n" +
                        "                    \"localcreditamount\":\"\",\n" +
                        "                    \"localdebitamount\":\"\",\n" +
                        "                    \"pk_accsubj\":\"660306\",\n" +
                        "                    \"pk_currtype\":\"CNY\"\n" +
                        "                },");
            }
            sb.append("{\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+sxf+"\",\n" +
                    "                    \"explanation\":\"收随行付\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },"+
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0401\"\n" + //随行付收款编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+sxfDf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收随行付\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112235\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //建行收款凭证
        if(jhskFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+jhsk+"\",\n" +
                    "                    \"explanation\":\"收建行\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0024\"\n" + //建行收款
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+jhsk+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收建行\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112209\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //废品凭证
        if(fpFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+fp+"\",\n" +
                    "                    \"explanation\":\"废品收入\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+fp+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"废品收入\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"605103\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //联联收款凭证
        if(llFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+ll+"\",\n" +
                    "                    \"explanation\":\"收联联\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0029\"\n" + //联联收款
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+ll+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收联联\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112218\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //抖音收款凭证
        if(dyFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+dy+"\",\n" +
                    "                    \"explanation\":\"收抖音\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0017\"\n" +//抖音收款编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+dy+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收抖音\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112220\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }

        //安徽抖音收款凭证
        if(ahdyFlag==1&&param.getRegion().equals("305")){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+ahdy+"\",\n" +
                    "                    \"explanation\":\"收抖音\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0017\"\n" +//抖音收款编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+ahdy+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收抖音\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112220\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }

        //商场收款凭证
        if(scskFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+scsk+"\",\n" +
                    "                    \"explanation\":\"收商场收款\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0056\"\n" +//商场收款编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+scsk+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收商场收款\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112219\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }

        //管培生工资凭证
        if(gpsFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+gps+"\",\n" +
                    "                    \"explanation\":\"管培生工资\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"-"+gps+"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"管培生工资\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660103\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }

        //当地平台收款凭证
        if(ddptFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+ddpt+"\",\n" +
                    "                    \"explanation\":\"收当地平台\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0014\"\n" +//当地平台收款编号
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+ddpt+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收当地平台\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112216\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }

        if(mtwmFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":"+yhk+"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    //借方科目
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+mtwm+"\",\n" +
                    "                    \"explanation\":\"收美团外卖\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    //贷方辅助核算
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":\"0035\"\n" + //美团外卖编号
                    "                        }\n" +
                    "                    ],\n" +
                    //贷方科目
                    "                    \"creditamount\":\""+mtwm+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"收美团外卖\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112211\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                }\n");
        }
        sb.append("            ],\n" +
                "            \"pk_corp\":"+param.getRegion()+",\n" +
                "            \"pk_glorgbook\":\""+param.getRegion()+"-bty01\",\n" +
                "            \"pk_prepared\":\"15253172037\",\n" +
                "            \"pk_vouchertype\":\"记账\",\n" +
                "            \"prepareddate\":"+lastDays+"\n" +
                "        }\n" +
                "    ]\n" +
                "}");
        //System.out.println("sb:"+sb);
        HttpEntity<String> formEntity = new HttpEntity<String>(sb.toString(), headers);
        String url = "http://124.70.28.147:8089/u8cloud/api/gl/voucher/insert";
        String result = restTemplate.postForEntity(url, formEntity, String.class).getBody();
        System.out.println("result:"+result);
        JsonParser jp = new JsonParser();
        //将json字符串转化成json对象
        JsonObject jo = jp.parse(result).getAsJsonObject();
        //获取errcode对应的值
        String status = jo.get("status").getAsString();

        if(status.equals("falied")){
            String errormsg = jo.get("errormsg").getAsString();
            return  ResponseData.error(501,errormsg);
        }else{
            return ResponseData.success();
        }
    }
    /**
     * 会员卡支出凭证
     */
    @RequestMapping(value = "/hykzc")
    @ResponseBody
    public ResponseData hykzc(BtyBankParam param) throws ParseException {
        String beginTime = "";
        String endTime = "";
        String firstDay = "";
        String lastDay = "";
        String lastDays = "";
        if (ToolUtil.isNotEmpty(param.getTimeLimit())) {
            String[] split = param.getTimeLimit().split(" - ");
            beginTime = split[0].replace("-", "");
            endTime = split[1].replace("-", "");
            //获取beginTime所在月的第一天和最后一天
            firstDay = DateUtil.getMonthFirstDay(beginTime);
            //lastDay=DateUtil.getMonthLastDay(beginTime);
            lastDay = DateUtil.getMonthLastDays(endTime);
            lastDays = DateUtil.getLastDayByMonths(split[1]);
            param.setBeginTime(beginTime);
            param.setEndTime(endTime);
            param.setFirstDay(firstDay);
            param.setLastDay(lastDay);
        }
        String yaoma = param.getYaoma();
        //通过妖码获取银行卡号
        BtyBrand brand = btyBrandService.getOne(new QueryWrapper<BtyBrand>().eq("yaoma", yaoma));
        String yhk = "";
        if (ToolUtil.isNotEmpty(brand)) {
            yhk = brand.getKh();
        }
        BtyBankResult hykzc = btyBankMapper.getHykzcByDm(param);
        //会员现金
        BigDecimal hyxj = BigDecimal.ZERO;
        //会员支付宝
        BigDecimal hyzfb = BigDecimal.ZERO;
        //会员微信
        BigDecimal hywx = BigDecimal.ZERO;
        //会员买单
        BigDecimal hymd = BigDecimal.ZERO;
        //会员建行
        BigDecimal hyjh = BigDecimal.ZERO;

        //会员随行付
        BigDecimal hysxf = BigDecimal.ZERO;

        //商场收款
        BigDecimal scsk = BigDecimal.ZERO;

        BigDecimal hyk = BigDecimal.ZERO;
        if (ToolUtil.isNotEmpty(hykzc)) {
            hyxj = hykzc.getHyxj();
            hyzfb = hykzc.getHyzfb();
            hywx = hykzc.getHywx();
            hymd = hykzc.getHymd();
            hyjh = hykzc.getHyjh();
            scsk = hykzc.getScsk();
            hysxf=hykzc.getHysxf();
            hyk = hyxj.add(hyzfb).add(hywx).add(hymd).add(hyjh).add(hysxf);
        }
        //会员现金标志
        int hyxjFlag = hyxj.compareTo(BigDecimal.ZERO);
        //会员支付宝标志
        int zfbFlag = hyzfb.compareTo(BigDecimal.ZERO);
        //会员微信标志
        int wxFlag = hywx.compareTo(BigDecimal.ZERO);
        //会员买单标志
        int mdFlag = hymd.compareTo(BigDecimal.ZERO);
        //会员建行标志
        int jhFlag = hyjh.compareTo(BigDecimal.ZERO);
        //商场收款标志
        int scskFlag = scsk.compareTo(BigDecimal.ZERO);

        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("trantype", "code"); // 档案翻译方式，枚举值为：编码请录入 code， 名称请录入 name， 主键请录入 pk
        headers.add("system", "001"); // 系统编码
        headers.add("usercode", "15253172037"); // 用户
        headers.add("password", "514576f58a89767b46c1b44767a08f77");
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        StringBuilder sb = new StringBuilder();
        sb.append("{\n" +
                "    \"voucher\":[\n" +
                "        {\n" +
                "            \"details\":[");
        //会员现金凭证
        if (hyxjFlag == 1) {
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'" + param.getYaoma() + "'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":'0038'\n" +//人民币编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+hyxj+"\",\n" +
                    "                    \"explanation\":\"会员卡充值支出\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112203\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },");
        }
        //会员微信凭证
        if (wxFlag == 1) {
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'" + param.getYaoma() + "'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":'0172'\n" +//微信收款编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+hywx+"\",\n" +
                    "                    \"explanation\":\"会员卡充值支出\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112206\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },");
        }
        //会员支付宝凭证
        if (zfbFlag == 1) {
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'" + param.getYaoma() + "'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":'0189'\n" +//支付宝收款编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+hyzfb+"\",\n" +
                    "                    \"explanation\":\"会员卡充值支出\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112207\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },");
        }
        //会员买单凭证
        if (mdFlag == 1) {
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'" + param.getYaoma() + "'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":'0015'\n" +//点评买单编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+hymd+"\",\n" +
                    "                    \"explanation\":\"会员卡充值支出\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112208\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },");
        }
        // 随行付凭证 0401
        if (hysxf.compareTo(BigDecimal.ZERO) == 1) {
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'" + param.getYaoma() + "'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":'0401'\n" +//随行付编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+hysxf+"\",\n" +
                    "                    \"explanation\":\"会员卡充值支出\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112235\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },");
        }

        //会员建行凭证 不是安徽大区的生到建行收款
        if (jhFlag == 1 && !param.getRegion().equals("305")) {
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'" + param.getYaoma() + "'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":'0024'\n" +//建行收款编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+hyjh+"\",\n" +
                    "                    \"explanation\":\"会员卡充值支出\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112209\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },");
        }
        //商场收款凭证 安徽大区的生到商场收款
        if (jhFlag == 1 && param.getRegion().equals("305")) {
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'" + param.getYaoma() + "'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"7\",\n" +
                    "                            \"checkvaluecode\":'0056'\n" +//商场收款编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+hyjh+"\",\n" +
                    "                    \"explanation\":\"会员卡充值支出\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"112219\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                },");
        }
        sb.append("{\n" +
                "                    \"ass\":[\n" +
                "                        {\n" +
                "                            \"checktypecode\":\"2\",\n" +
                "                            \"checkvaluecode\":'" + param.getYaoma() + "'\n" +
                "                        },\n" +
                "                        {\n" +
                "                            \"checktypecode\":\"96\",\n" +
                "                            \"checkvaluecode\":" + yhk + "\n" +
                "                        }\n" +
                "                    ],\n" +
                "                    \"creditamount\":\""+ hyk + "\",\n" +
                "                    \"debitamount\":\"\",\n" +
                "                    \"explanation\":\"会员卡充值支出\",\n" +
                "                    \"localcreditamount\":\"\",\n" +
                "                    \"localdebitamount\":\"\",\n" +
                "                    \"pk_accsubj\":\"100202\",\n" +
                "                    \"pk_currtype\":\"CNY\"\n" +
                "                }");
        sb.append("            ],\n" +
                "            \"pk_corp\":"+param.getRegion()+",\n" +
                "            \"pk_glorgbook\":\""+param.getRegion()+"-bty01\",\n" +
                "            \"pk_prepared\":\"15253172037\",\n" +
                "            \"pk_vouchertype\":\"记账\",\n" +
                "            \"prepareddate\":"+lastDays+"\n" +
                "        }\n" +
                "    ]\n" +
                "}");
        System.out.println("sb:"+sb);
        HttpEntity<String> formEntity = new HttpEntity<String>(sb.toString(), headers);
        String url = "http://124.70.28.147:8089/u8cloud/api/gl/voucher/insert";
        String result = restTemplate.postForEntity(url, formEntity, String.class).getBody();
        System.out.println("result:"+result);
        JsonParser jp = new JsonParser();
        //将json字符串转化成json对象
        JsonObject jo = jp.parse(result).getAsJsonObject();
        //获取errcode对应的值
        String status = jo.get("status").getAsString();

        if(status.equals("falied")){
            String errormsg = jo.get("errormsg").getAsString();
            return  ResponseData.error(501,errormsg);
        }else{
            return ResponseData.success();
        }
    }

    /**
     * 银行账支出凭证
     */
    @RequestMapping(value = "/zcpz")
    @ResponseBody
    public ResponseData zcpz(BtyBankParam param){
        String beginTime = "";
        String endTime = "";
        String lastDay="";
        if (ToolUtil.isNotEmpty(param.getTimeLimit())) {
            String[] split = param.getTimeLimit().split(" - ");
            beginTime = split[0].replace("-","");
            endTime = split[1].replace("-","");
            int month1 = Integer.valueOf(beginTime.substring(4,6));
            int month2 = Integer.valueOf(endTime.substring(4,6));
            if(month1==month2){
                //获取当前日期本月的最后一天
                lastDay=DateUtil.getLastDayByMonth(split[1]);
            }else {
                //获取当前日期上个月的最后一天
                lastDay = DateUtil.getLastDayByMonths(split[1]);
            }
            param.setBeginTime(beginTime);
            param.setEndTime(endTime);
        }
        String yaoma=param.getYaoma();
        //通过妖码获取银行卡号
        BtyBrand brand=btyBrandService.getOne(new QueryWrapper<BtyBrand>().eq("yaoma",yaoma));
        String yhk="";
        if(ToolUtil.isNotEmpty(brand)){
            yhk=brand.getKh();
        }
        List<BtyBankResult>list=btyBankMapper.bankZcListByDm(param);

        //配送费
        BigDecimal psf=BigDecimal.ZERO;
        //糖浆
        BigDecimal tj=BigDecimal.ZERO;
        //青菜
        BigDecimal qc=BigDecimal.ZERO;
        //自采报销
        BigDecimal zcbx=BigDecimal.ZERO;
        //督导差旅费
        BigDecimal ddclf=BigDecimal.ZERO;
        //绩效
        BigDecimal jx=BigDecimal.ZERO;
        //美团抽点
        BigDecimal mtcd=BigDecimal.ZERO;
        //管理费
        BigDecimal glf=BigDecimal.ZERO;
        //品牌使用费
        BigDecimal ppsyf=BigDecimal.ZERO;
        //维修费
        BigDecimal wxf=BigDecimal.ZERO;
        //分红
        BigDecimal fh=BigDecimal.ZERO;
        //推广费
        BigDecimal tgf=BigDecimal.ZERO;
        //酒水
        BigDecimal js=BigDecimal.ZERO;
        //宿舍房租
        BigDecimal ssfz=BigDecimal.ZERO;
        //门店租金
        BigDecimal mdzj=BigDecimal.ZERO;

        //工资
        BigDecimal gz=BigDecimal.ZERO;
        //水费
        BigDecimal sf=BigDecimal.ZERO;
        //电费
        BigDecimal df=BigDecimal.ZERO;
        //押金
        BigDecimal yj=BigDecimal.ZERO;
        //广告费
        BigDecimal ggf=BigDecimal.ZERO;
        //意外险
        BigDecimal ywx=BigDecimal.ZERO;
        //软件费
        BigDecimal rjf=BigDecimal.ZERO;
        //装修欠款
        BigDecimal zxqk=BigDecimal.ZERO;
        //调料
        BigDecimal tl=BigDecimal.ZERO;
        //供应链
        BigDecimal gyl=BigDecimal.ZERO;
        //千层饼
        BigDecimal qcb=BigDecimal.ZERO;
        //系统北京社保
        BigDecimal bjsb=BigDecimal.ZERO;

        //天津社保
        BigDecimal tjsb=BigDecimal.ZERO;

        //抖音服务费
        BigDecimal dyfwf=BigDecimal.ZERO;

        int sbNum=btyBankMapper.shebaoNum(param);

        for (BtyBankResult yybbResult : list) {
            String zy=yybbResult.getZy()==null?"":yybbResult.getZy();
            if(zy.contains("配送")){
                psf=psf.add(yybbResult.getZc());
            }  if(zy.contains("糖浆")){
                tj=tj.add(yybbResult.getZc());
            } if(zy.contains("青菜")){
                qc=qc.add(yybbResult.getZc());
            }//自采报销，采购报销，日常报销，报销,日常，日常费用，采购，自采
             if(zy.contains("报销")|zy.contains("日常")|zy.contains("采购")|zy.contains("自采")){
                zcbx=zcbx.add(yybbResult.getZc());
            }if(zy.contains("差旅费")){
                ddclf=ddclf.add(yybbResult.getZc());
            } if(zy.contains("绩效分")){
                jx=jx.add(yybbResult.getZc());
            }
             if(zy.contains("美团提点")){
                mtcd=mtcd.add(yybbResult.getZc());
            } if(zy.contains("管理费")){
                glf=glf.add(yybbResult.getZc());
            }
             if(zy.contains("品牌使用费")){
                ppsyf=ppsyf.add(yybbResult.getZc());
            } if(zy.contains("维修费")){
                wxf=wxf.add(yybbResult.getZc());
            } if(zy.contains("分红")){
                fh=fh.add(yybbResult.getZc());
            }if(zy.contains("推广费")){
                tgf=tgf.add(yybbResult.getZc());
            } if(zy.contains("酒水")){
                js=js.add(yybbResult.getZc());
            } if(zy.contains("宿舍房租")|zy.contains("宿舍")){
                ssfz=ssfz.add(yybbResult.getZc());
            } if(zy.contains("工资")){
                gz=gz.add(yybbResult.getZc());
            } if(zy.contains("门店租金")){
                mdzj=mdzj.add(yybbResult.getZc());
            } if(zy.contains("水费")){
                sf=sf.add(yybbResult.getZc());
            }if(zy.contains("电费")){
                df=df.add(yybbResult.getZc());
            }
            if(zy.contains("押金")){
                yj=yj.add(yybbResult.getZc());
            }if(zy.contains("广告费")){
                ggf=ggf.add(yybbResult.getZc());
            } if(zy.contains("意外险")){
                ywx=ywx.add(yybbResult.getZc());
            }if(zy.contains("软件费")){
                rjf=rjf.add(yybbResult.getZc());
            } if(zy.contains("装修欠款")){
                zxqk=zxqk.add(yybbResult.getZc());
            }
            if(zy.contains("调料")){
                tl=tl.add(yybbResult.getZc());
            }
            if(zy.contains("供应链")){
                gyl=gyl.add(yybbResult.getZc());
            }
            if(zy.contains("千层饼")){
                qcb=qcb.add(yybbResult.getZc());
            }
            if(zy.contains("系统北京社保")){
                bjsb=bjsb.add(yybbResult.getZc());
            }
            if(zy.contains("天津社保")){
                tjsb=tjsb.add(yybbResult.getZc());
            }

            if(zy.contains("抖音服务费")){
                dyfwf=dyfwf.add(yybbResult.getZc());
            }
        }

        //配送费标志
        int psfFlag=psf.compareTo(BigDecimal.ZERO);
        //糖浆标志
        int tjFlag=tj.compareTo(BigDecimal.ZERO);
        //青菜标志
        int qcFlag=qc.compareTo(BigDecimal.ZERO);
        //自采报销标志
        int zcbxFlag=zcbx.compareTo(BigDecimal.ZERO);
        //差旅费标志
        int ddclfFlag=ddclf.compareTo(BigDecimal.ZERO);
        //绩效标志
        int jxFlag=jx.compareTo(BigDecimal.ZERO);
        //美团抽点标志
        int mtcdFlag=mtcd.compareTo(BigDecimal.ZERO);
        //管理费标志
        int glfFlag=glf.compareTo(BigDecimal.ZERO);
        //品牌使用费标志
        int ppsyfFlag=ppsyf.compareTo(BigDecimal.ZERO);
        //维修费标志
        int wxfFlag=wxf.compareTo(BigDecimal.ZERO);
        //分红标志
        int fhFlag=fh.compareTo(BigDecimal.ZERO);
        //推广费标志
        int tgfFlag=tgf.compareTo(BigDecimal.ZERO);
        //酒水标志
        int jsFlag=js.compareTo(BigDecimal.ZERO);
        //宿舍房租标志
        int ssfzFlag=ssfz.compareTo(BigDecimal.ZERO);
        //工资标志
        int gzFlag=gz.compareTo(BigDecimal.ZERO);
        //门店租金标志
        int mdzjFlag=mdzj.compareTo(BigDecimal.ZERO);
        //水费标志
        int sfFlag=sf.compareTo(BigDecimal.ZERO);
        //电费标志
        int dfFlag=df.compareTo(BigDecimal.ZERO);
        //押金标志
        int yjFlag=yj.compareTo(BigDecimal.ZERO);
        //广告费标志
        int ggfFlag=ggf.compareTo(BigDecimal.ZERO);
        //意外险标志
        int ywxFlag=ywx.compareTo(BigDecimal.ZERO);
        //软件费标志
        int rjfFlag=rjf.compareTo(BigDecimal.ZERO);
        //装修欠款标志
        int zxqkFlag=zxqk.compareTo(BigDecimal.ZERO);
        //调料标志
        int tlFlag=tl.compareTo(BigDecimal.ZERO);
        //供应链标志
        int gylFlag=gyl.compareTo(BigDecimal.ZERO);
        //千层饼标志
        int qcbFlag=qcb.compareTo(BigDecimal.ZERO);

        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("trantype", "code"); // 档案翻译方式，枚举值为：编码请录入 code， 名称请录入 name， 主键请录入 pk
        headers.add("system", "001"); // 系统编码
        headers.add("usercode", "15253172037"); // 用户
        headers.add("password", "514576f58a89767b46c1b44767a08f77");
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());

        StringBuilder sb=new StringBuilder();
        sb.append("{\n" +
                "    \"voucher\":[\n" +
                "        {\n" +
                "            \"details\":[");
        //配送费凭证
        if(psfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"201\"\n" +//山东配送中心编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+psf+"\",\n" +
                    "                    \"explanation\":\"付配送\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+psf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付配送\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //糖浆凭证
        if(tjFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030800003\"\n" +//糖浆辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+tj+"\",\n" +
                    "                    \"explanation\":\"付糖浆\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+tj+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付糖浆\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //工资凭证
        if(gzFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+gz+"\",\n" +
                    "                    \"explanation\":\"付工资\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660103\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+gz+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付工资\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //青菜凭证
        if(qcFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030100404\"\n" +//青菜辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+qc+"\",\n" +
                    "                    \"explanation\":\"付青菜\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+qc+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付青菜\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
       //自采报销凭证
        if(zcbxFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030800001\"\n" +//自采报销辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+zcbx+"\",\n" +
                    "                    \"explanation\":\"付自采报销\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+zcbx+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付自采报销\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //差旅费凭证
        if(ddclfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030800001\"\n" +//采购报销辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+ddclf+"\",\n" +
                    "                    \"explanation\":\"付差旅费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+ddclf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付差旅费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //绩效凭证
        if(jxFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+jx+"\",\n" +
                    "                    \"explanation\":\"付绩效\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660105\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+jx+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付绩效\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //美团抽点凭证
        if(mtcdFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+mtcd+"\",\n" +
                    "                    \"explanation\":\"付美团抽点\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"224103\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+mtcd+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付美团抽点\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //管理费凭证
        if(glfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+glf+"\",\n" +
                    "                    \"explanation\":\"付管理费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"224102\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+glf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付管理费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //品牌使用费凭证
        if(ppsyfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+ppsyf+"\",\n" +
                    "                    \"explanation\":\"付品牌使用费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660126\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+ppsyf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付品牌使用费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //维修费凭证
        if(wxfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+wxf+"\",\n" +
                    "                    \"explanation\":\"付维修费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660119\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+wxf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付维修费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //推广费凭证
        if(tgfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+tgf+"\",\n" +
                    "                    \"explanation\":\"付推广费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660131\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+tgf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付推广费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //宿舍房租凭证
        if(ssfzFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030800001\"\n" +//采购报销辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+ssfz+"\",\n" +
                    "                    \"explanation\":\"付宿舍房租\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+ssfz+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付宿舍房租\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //门店租金凭证
        if(mdzjFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030800001\"\n" +//采购报销辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+mdzj+"\",\n" +
                    "                    \"explanation\":\"付门店租金\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+mdzj+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付门店租金\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //酒水凭证
        if(jsFlag==1) {
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030200013\"\n" +//马其文酒水编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+js+"\",\n" +
                    "                    \"explanation\":\"付酒水\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+js+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付酒水\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //分红凭证
        if(fhFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+fh+"\",\n" +
                    "                    \"explanation\":\"付分红\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"410401\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+fh+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付分红\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //水费凭证
        if(sfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030800001\"\n" +//采购报销辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+sf+"\",\n" +
                    "                    \"explanation\":\"付水费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+sf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付水费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //电费凭证
        if(dfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030800001\"\n" +//采购报销辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+df+"\",\n" +
                    "                    \"explanation\":\"付电费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+df+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付电费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //押金凭证
        if(yjFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"0600006\"\n" +//宿舍押金辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+yj+"\",\n" +
                    "                    \"explanation\":\"付押金\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"123102\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +//宿舍押金辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+yj+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付押金\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //广告费凭证
        if(ggfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030800001\"\n" +//采购报销辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+ggf+"\",\n" +
                    "                    \"explanation\":\"付广告费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+ggf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付广告费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //意外险凭证
        if(ywxFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+ywx+"\",\n" +
                    "                    \"explanation\":\"付意外险\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660199\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+ywx+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付意外险\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //软件费凭证
        if(rjfFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+rjf+"\",\n" +
                    "                    \"explanation\":\"付软件费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660110\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+rjf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付软件费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //装修欠款凭证
        if(zxqkFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+zxqk+"\",\n" +
                    "                    \"explanation\":\"付装修欠款\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"410401\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+zxqk+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付装修欠款\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //调料凭证
        if(tlFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030600008\"\n" +//调料辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+tl+"\",\n" +
                    "                    \"explanation\":\"付调料\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+tl+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付调料\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //供应链凭证
        if(gylFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+gyl+"\",\n" +
                    "                    \"explanation\":\"付供应链\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660111\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+gyl+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付供应链\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        //千层饼凭证
        if(qcbFlag==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"030400083\"\n" +//千层饼辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+qcb+"\",\n" +
                    "                    \"explanation\":\"千层饼\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"2202\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+qcb+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"千层饼\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }

        //抖音服务费凭证
        if(dyfwf.compareTo(BigDecimal.ZERO)==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+dyfwf+"\",\n" +
                    "                    \"explanation\":\"付抖音服务费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660131\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+dyfwf+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付抖音服务费\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }

        //天津社保凭证
        if(tjsb.compareTo(BigDecimal.ZERO)==1){
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+tjsb+"\",\n" +
                    "                    \"explanation\":\"付社保\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660104\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+tjsb+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付社保\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }

        //北京社保凭证
        if(sbNum>0){
            BigDecimal decimal=new BigDecimal(565.8);
            BigDecimal decimals=new BigDecimal(1431.12);
            BigDecimal amount=decimal.multiply(BigDecimal.valueOf(sbNum)).setScale(2,BigDecimal.ROUND_HALF_UP);
            BigDecimal amount1=decimals.multiply(BigDecimal.valueOf(sbNum)).setScale(2,BigDecimal.ROUND_HALF_UP);
            sb.append("                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"73\",\n" +
                    "                            \"checkvaluecode\":\"9900011\"\n" +//社保辅助核算编码
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+amount+"\",\n" +
                    "                    \"explanation\":\"付社保\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"123199\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "                {\n" +
                    "                    \"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\"\",\n" +
                    "                    \"debitamount\":\""+amount1+"\",\n" +
                    "                    \"explanation\":\"付社保\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"660103\",\n" +
                    "                    \"pk_currtype\":\"CNY\"\n" +
                    "                }," +
                    "{\n" +
                    "\t\t\t\t\"ass\":[\n" +
                    "                        {\n" +
                    "                            \"checktypecode\":\"2\",\n" +
                    "                            \"checkvaluecode\":'"+yaoma+"'\n" +
                    "                        },\n" +
                    "\t\t\t\t\t\t{\n" +
                    "                            \"checktypecode\":\"96\",\n" +
                    "                            \"checkvaluecode\":\""+yhk+"\"\n" +
                    "                        }\n" +
                    "                    ],\n" +
                    "                    \"creditamount\":\""+bjsb+"\",\n" +
                    "                    \"creditquantity\":\"\",\n" +
                    "                    \"debitamount\":\"\",\n" +
                    "                    \"debitquantity\":\"\",\n" +
                    "                    \"detailindex\":\"\",\n" +
                    "                    \"excrate1\":\"\",\n" +
                    "                    \"explanation\":\"付社保\",\n" +
                    "                    \"localcreditamount\":\"\",\n" +
                    "                    \"localdebitamount\":\"\",\n" +
                    "                    \"pk_accsubj\":\"100202\",\n" +
                    "                    \"pk_currtype\":\"CNY\",\n" +
                    "                    \"price\":\"\"\n" +
                    "                },\n");
        }
        sb.append("            ],\n" +
                "            \"pk_corp\":"+param.getRegion()+",\n" +
                "            \"pk_glorgbook\":\""+param.getRegion()+"-bty01\",\n" +
                "            \"pk_prepared\":\"15253172037\",\n" +
                "            \"pk_vouchertype\":\"记账\",\n" +
                "            \"prepareddate\":"+lastDay+"\n" +
                "        }\n" +
                "    ]\n" +
                "}");
        //System.out.println("sb:"+sb.toString());
        HttpEntity<String> formEntity = new HttpEntity<String>(sb.toString(), headers);
        String url = "http://124.70.28.147:8089/u8cloud/api/gl/voucher/insert";
        String result = restTemplate.postForEntity(url, formEntity, String.class).getBody();
        System.out.println("result:"+result);
        JsonParser jp = new JsonParser();
        //将json字符串转化成json对象
        JsonObject jo = jp.parse(result).getAsJsonObject();
        //获取errcode对应的值
        String status = jo.get("status").getAsString();

        if(status.equals("falied")){
            String errormsg = jo.get("errormsg").getAsString();
            return  ResponseData.error(501,errormsg);
        }else{
            return ResponseData.success();
        }
    }
}


